package com.example.demo.Configure;

        import org.springframework.beans.BeansException;
        import org.springframework.beans.factory.BeanFactory;
        import org.springframework.beans.factory.BeanFactoryAware;
        import org.springframework.stereotype.Component;

@Component
public class BeanTools  implements BeanFactoryAware {
    private static BeanFactory beanFactory;

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        this.beanFactory=beanFactory;
    }

    public static Object getBean(Class name){
        return beanFactory.getBean(name);
    }
}
